Skip to content

CollectiveX: time the pair period without events between pairs / CollectiveX:pair period 计时不再在 pair 之间插入 event - #5039

Merged
Oseltamivir merged 3 commits into
mainfrom
collectivex/pair-period-span
Nov 12, 2026
Merged

Oseltamivir merged 3 commits into
mainfrom
collectivex/pair-period-span

Conversation

@Oseltamivir

@Oseltamivir Oseltamivir commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

pair_period, the CollectiveX headline, read 12–26% too high at small batches. It was the window between two CUDA events around one dispatch+combine pair, and an event node costs device time of its own: two adjacent event nodes in a replayed graph sit 2.4–3.3 µs apart on NVIDIA GPUs and about 6 µs on AMD, and a window around real kernels carries more. An engine's decode graph has no event between its layers.

Measured on all nine pools with a chain whose only events are at its two ends (EP8 decode BF16, T=1, µs):

FlashInfer-EP NCCL-EP LL DeepEP V2
H100 23.2 → 18.6 27.6 → 23.2 40.2 → 34.8
H200 21.9 → 17.1 25.6 → 20.7 36.0 → 28.9
B200 30.1 → 23.5 34.1 → 25.7 52.7 → 42.8
B300 31.7 → 23.4 33.8 → 25.7 54.3 → 43.8
GB200 30.6 → 24.6 29.5 → 23.4 51.0 → 39.3
GB300 30.1 → 24.7 28.9 → 23.0 49.9 → 38.4

MoRI: MI300X 47.3 → 41.5, MI325X 47.0 → 41.3, MI355X 48.9 → 42.4. The extra is 4.5–13.5 µs on NVIDIA and about 6 µs on AMD, differs by pool and library, and stays roughly constant up the ladder (2–11% at T=512). The fastest library at T=1, 8 and 64 is the same on every pool either way.

Change

  • Span chain. Each chain trial runs a third sibling with two events only: one before its first kept pair and one after its last. Its time per pair sets pair_period's level (cross-rank median). The pair windows keep the spread: each trial's windows are shifted so their median sits at that trial's span value, and the percentiles are taken over the shifted windows.
  • chain_health.window_overhead_us reports what the pair windows read above the span, and pair_period.origin becomes chained-span-median. InferenceX-app reads neither field today.
  • swap-blocks takes 40 iterations per point in every profile instead of 100, which took too long; p99 is then the slowest sample.
  • A non-finite error (NaN output, shape mismatch) no longer crashes the result writer: the case ends invalid with the magnitude null.
  • Methodology: the chain floors each hold their own events' cost and can sum to more than the pair period (the old text said the opposite); bandwidth is a per-GPU rate. Both chain diagrams are redrawn.

Impact

Every published EP row needs re-measuring. Rows measured before this PR carry pair_period.origin: chained-median and read high by the amounts above; a subtraction cannot correct them, because the extra depends on pool and library. Fresh-entry roundtrip, dispatch, combine and the chain floors are still single windows and keep their events' cost, which matters only at small batches. The 18 swap-blocks rows also need a re-run at 40 iterations.

Validation

Hand runs from the pools' login nodes (no Actions run). This branch's harness reproduces the events-at-the-ends probe, pair_period p50 at T=1 in µs: B200 FlashInfer-EP 23.48 (probe 23.45), B200 DeepEP V2 42.91 (42.78), H200 NCCL-EP LL 20.78 (20.69), MI325X MoRI 41.28 (41.27), MI325X UCCL-EP eager 244.6 (242.3). Every decode rung of the four graphed cases agrees with the probe within 1.1 µs, and the eager case within 1.5%.

The final commit then ran clean, from a clean checkout, on B200 (FlashInfer-EP BF16 and FP8, DeepEP V2 low-latency, DeepEP V2 two-node EP16, NCCL-EP normal, UCCL-EP low-latency, swap-blocks), MI325X (MoRI EP8 and low-latency EP16) and GB300 (NCCL-EP low-latency EP16): 17 EP cases and both swap-blocks cases, all success. Each new pair_period equals the published value minus that case's window_overhead_us (for example DeepEP V2 low-latency on B200 at T=1: 50.6 → 42.6, overhead 8.0).

Validation details
  • Probe: 28 shards on nine pools (FlashInfer-EP, DeepEP V2, NCCL-EP LL and normal on the six NVIDIA pools; MoRI on the three AMD pools; UCCL-EP on MI325X), all success. Each chain trial captured the period chain again with one event window per 1, 2, 4, 8, 16, 56 and 112 pairs; a window of N pairs fits N × pair + constant within 0.4 µs for FlashInfer-EP and 1 µs for DeepEP V2, and the 112-pair value agrees across ranks and trials to 0.01 µs.
  • The probe's own one-pair windows reproduce the published p50 of the same cases within 0.3 µs at the median (4.0 µs at worst), so the pools had not drifted.
  • A graph holding only event nodes and a 10 µs spin kernel shows the same cost without any library: the window around one spin reads 3.7–5.4 µs above back-to-back spins on NVIDIA and 5.9–6.3 µs on AMD.
中文

CollectiveX 的主指标 pair_period 在小 batch 下偏高 12–26%。它原先是一对 dispatch+combine 前后两个 CUDA event 之间的窗口,而 event 节点本身要占用设备时间:在重放的 graph 中,两个相邻 event 节点在 NVIDIA GPU 上相隔 2.4–3.3 µs,在 AMD 上约 6 µs,包住真实 kernel 的窗口代价更大。推理引擎的 decode graph 在各层之间并没有 event。

在全部九个资源池上,用只在首尾各放一个 event 的链重新测量(EP8 decode BF16,T=1)的结果见上表:NVIDIA 上多出 4.5–13.5 µs,AMD 上约 6 µs,随资源池和库而异,并且沿 token 阶梯基本保持不变(T=512 时为 2–11%)。各资源池在 T=1、8、64 下最快的库不变。

改动

  • span chain: 每个 chain trial 增加第三条链,只在第一个保留 pair 之前和最后一个 pair 之后各记录一个 event。它的每 pair 时间决定 pair_period 的水平(跨 rank 取中位数);逐 pair 窗口只提供离散程度:每个 trial 的窗口整体平移,使其中位数落在该 trial 的 span 值上,再对平移后的窗口取百分位。
  • 新增 chain_health.window_overhead_us,即逐 pair 窗口比 span 高出的部分;pair_period.origin 改为 chained-span-median。InferenceX-app 目前不读取这两个字段。
  • swap-blocks 所有 profile 每个点改为 40 次迭代(原为 100 次,耗时过长),因此 p99 即最慢的一个样本。
  • 非有限误差(输出为 NaN 或形状不匹配)不再使结果写入崩溃:该 case 以 invalid 结束,误差值记为 null。
  • 方法论: chain floors 各自包含自身 event 的代价,二者之和可以超过 pair period(旧文档的说法相反);带宽是每 GPU 的速率。两张链示意图已重绘。

影响

所有已发布的 EP 结果都需要重新测量。 本 PR 之前测得的行带有 pair_period.origin: chained-median,偏高幅度如上;由于偏差随资源池和库变化,无法用减法修正。fresh-entry 的 roundtrip、dispatch、combine 以及 chain floors 仍是单个窗口,仍含 event 的代价,只在小 batch 下有影响。18 行 swap-blocks 结果也需按 40 次迭代重跑。

验证

在各资源池登录节点手动运行(无 Actions 运行)。本分支的测试框架复现了首尾 event 探针的结果,T=1 的 pair_period p50(µs):B200 FlashInfer-EP 23.48(探针 23.45)、B200 DeepEP V2 42.91(42.78)、H200 NCCL-EP LL 20.78(20.69)、MI325X MoRI 41.28(41.27)、MI325X UCCL-EP eager 244.6(242.3)。四个 graph case 的每个 decode 档位与探针相差均在 1.1 µs 以内,eager case 在 1.5% 以内。

随后用最终提交、在干净的检出上再次运行:B200(FlashInfer-EP BF16 与 FP8、DeepEP V2 低延迟、DeepEP V2 双节点 EP16、NCCL-EP normal、UCCL-EP 低延迟、swap-blocks)、MI325X(MoRI EP8 与低延迟 EP16)和 GB300(NCCL-EP 低延迟 EP16),共 17 个 EP case 和两个 swap-blocks case,全部 success。每个新的 pair_period 都等于已发布值减去该 case 的 window_overhead_us(例如 B200 上 DeepEP V2 低延迟在 T=1:50.6 → 42.6,overhead 8.0)。

AI model disclosure
  • claude-mythos-5-2: found the overhead in the published data, designed and ran the probe and the validation runs, and wrote the change, tests, docs, diagrams and this description.
  • claude-mythos-5-2 (delegated review agent): found the result-writer crash and the two methodology errors during an audit.

The published pair period was a window between two CUDA events around one
dispatch+combine pair. An event node costs device time of its own, so the
window read above what back-to-back pairs cost: 4.5-13.5 us at T=1 on
NVIDIA EP8 and about 6 us on AMD, roughly constant in T.

Each chain trial now runs a third sibling, the span chain, with one event
before its first kept pair and one after its last. Its time per pair sets
the period's level; the pair windows, shifted onto it per trial, keep the
pair-to-pair spread. chain_health.window_overhead_us reports what the
windows read above the span, and the component's origin becomes
chained-span-median.

Also:
- swap-blocks profiles take 40 iterations per point instead of 100;
- an error that is not finite (NaN output, shape mismatch) is written as
  null beside its failed verdict instead of crashing the result writer;
- methodology: the chain floors can sum to more than the pair period, and
  bandwidth is a per-GPU rate.
…s are captured

Keeps at most two chain graphs alive at once, as before the span chain was added.
@Oseltamivir
Oseltamivir marked this pull request as ready for review November 12, 2026 11:40
@Oseltamivir
Oseltamivir requested a review from a team November 12, 2026 11:40
@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Oseltamivir's task in 1m 7s —— View job


Review of PR #5039

  • Gather context
  • Review harness/timing changes (ep_harness.py, ep_timing.py), tests, configs and the changelog
  • Post findings

LGTM - no blocking issues found.

What I checked
  • Graph span capture: capture_pairs makes one start/end stamp for "span". It records the start at i == span_head and the end after the last pair. record() does nothing for marks that weren't requested, so the floors and period captures are unchanged. The existing budget gate prevents kept == 0, so span_head < iters always holds.
  • Eager span chain: It runs the dropped head before span_start.record(), opens with the all-reduce alone, and goes through the same host-gate retry loop as the other siblings.
  • Level and spread: Each trial's windows are shifted by p50(cross-rank median windows) − median(span across ranks). This keeps their spread and puts the level at the span. window_overhead_us gets one scalar per trial. Nothing in this repo checks origin == "chained-median": summarize.py reads only pair_period.percentiles_us. So renaming it to chained-span-median breaks nothing here. I didn't check InferenceX-app; that rests on the PR's claim.
  • Errors that aren't finite: _error_for_max turns NaN into infinity before the MAX reduction. _recorded_error writes null for JSON, and the new test covers the chain, graph and oracle sources.
  • Changelog: Both entries are appended at the end of collectivex/perf-changelog.yaml, and the PR doesn't touch inferencex-e2e.

I couldn't run tests/test_chain.py because pytest isn't on this job's allowed Bash commands.

Comment thread collectivex/bench/ep_harness.py Resolved
@Oseltamivir
Oseltamivir merged commit 0fa0fa5 into main Nov 12, 2026
27 checks passed
@Oseltamivir
Oseltamivir deleted the collectivex/pair-period-span branch November 12, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant